﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace Csharptest
{
    public partial class FormMain : Form
    {
        private int a = 1;
        private Boolean down = true;
        string[] RandOrd = new string[20];
        string[] RandFont = new string[20];

        
        
        public FormMain()
        {
            InitializeComponent();

        }
        private void FormMain_Load(object sender, EventArgs e)
        {
            RandOrdInit();
            RandFontInit();
            
        }

        private void label1_Click(object sender, EventArgs e)
        {
            Random r1 = new Random();
            this.Pastasallad.Text = RandOrd[r1.Next(0, 19)];
            this.Pastasallad.Font = new System.Drawing.Font(RandFont[r1.Next(0, 19)], 40F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            a = -10;
            down = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Pastasallad.Location.Y >= 800 && down == true && a > 0)
            {
                down = false;
            }
            
            if ( down )
                Pastasallad.Location = new Point(Pastasallad.Location.X, Pastasallad.Location.Y + a);
            

            this.Invalidate();
            a++;
        }

        private void RandOrdInit()
        {
            RandOrd[0] = "Bajsmannen";
            RandOrd[1] = "Skaru ha stryk?";
            RandOrd[2] = "Dansbandskampen";
            RandOrd[3] = "Leksakstroll";
            RandOrd[4] = "Fy fan, äre sant?";
            RandOrd[5] = "Mmmm, tacopaj";
            RandOrd[6] = "Ost";
            RandOrd[7] = "Takläggare";
            RandOrd[8] = "Chips och dipp";
            RandOrd[9] = "Påläggsmacka";
            RandOrd[10] = "Ok, så två hästar går in på en bar...";
            RandOrd[11] = "Magnus, la du lås?";
            RandOrd[12] = "Öl...ÖL!";
            RandOrd[13] = "\"Rolig text\"";
            RandOrd[14] = "Lappskojs";
            RandOrd[15] = "Påslakan";
            RandOrd[16] = "Laktos i en tolerant människa";
            RandOrd[17] = "Tryck då för i helvete, du är ändå inte min riktiga morsa";
            RandOrd[18] = "Adolf, hit ler ingen";
            RandOrd[19] = "Per Vers";
        }

        private void RandFontInit()
        {
            RandFont[0] = "Arial Black";
            RandFont[1] = "Algerian";
            RandFont[2] = "Bradley Hand ITC";
            RandFont[3] = "AIGDT";
            RandFont[4] = "Buxton Sketch";
            RandFont[5] = "Lucida Console";
            RandFont[6] = "Bodoni MT Black";
            RandFont[7] = "Jokerman";
            RandFont[8] = "Gill Sans Ultra Bold";
            RandFont[9] = "Ravie";
            RandFont[10] = "Snap ITC";
            RandFont[11] = "Playbill";
            RandFont[12] = "Palatino";
            RandFont[13] = "Kristen ITC";
            RandFont[14] = "MV Boli";
            RandFont[15] = "Wide Latin";
            RandFont[16] = "Britannic Bold";
            RandFont[17] = "Viner Hand ITC";
            RandFont[18] = "Andalus";
            RandFont[19] = "Rockwell";
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {

        }

        private void textBox1_KeyDown_1(object sender, KeyEventArgs e)
        {
            if (Keys.Enter == e.KeyCode && Pastasallad.Text.CompareTo(Svar.Text)==0)
            {
                Svar.Clear();
                Random r1 = new Random();
                this.Pastasallad.Text = RandOrd[r1.Next(0, 19)];
                this.Pastasallad.Font = new System.Drawing.Font(RandFont[r1.Next(0, 19)], 40F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                a = -30;
                down = true;
            }

        }

    }

}
